package com.mg.plugin.agrometeorology.model;

import com.mg.model.Model;
import com.mg.model.Param;
import com.mg.model.Port;
import com.mg.plugin.agrometeorology.entity.WeaData;
import com.mg.pluginexample2.ModuleBase;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class DeterminantModel extends ModuleBase {

    public DeterminantModel(int nID) {
        super(nID);
        m_alInputPort.add(new Port(this, Port.Type.Unknown));
        m_alOutputPort.add(new Port(this, Port.Type.Unknown));
    }

    public String GetGroupName() {
        return "产量预报";
    }

    public String GetName() {
        return "四阶行列式计算";
    }

    public String GetDescription() {
        return "基于关键气象因子影响指数方法（数据必须是同一年的）";
    }

    public boolean OnAttach(Port portFrom, Port portTo) {
        try {
            int i = FindPort(portFrom, false);
            if (i != -1) {
                return true;
            }
            i = FindPort(portTo, true);
            if (i == -1) {
                return false;
            }

            ArrayList<Param> alParam = new ArrayList<Param>();
            portFrom.GetModule().GetOutputParam(portFrom, alParam);

            if (alParam.size() != 1) {
                return false;
            }

            if (alParam.get(0).m_objValue != null && !(alParam.get(0).m_objValue instanceof ArrayList)) {
                m_model.OutputLog(Model.LogLevel.Info, "alParam.get(0).m_objValue != null && !(alParam.get(0).m_objValue instanceof ArrayList)");
                return false;
            }
            if (i == 0) {
                m_model.OutputLog(Model.LogLevel.Info, "SET m_inputStationDataList");
                m_inputStationDataList = (List<String>) alParam.get(0).m_objValue;
            }
            if (i == 1) {
                m_model.OutputLog(Model.LogLevel.Info, "m_inputRealityList" + alParam.get(0).m_objValue.getClass());
                m_inputRealityList = (List<String>) alParam.get(0).m_objValue;
            }

            portTo.SetType(portFrom.GetType());
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
        return true;
    }

    public boolean OnDetach(Port portFrom, Port portTo) {
        if (!super.OnDetach(portFrom, portTo))
            return false;
        try {
            int i = FindPort(portTo, true);
            if (i == -1)
                return true;
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
    }

    //用于 参数->XML 等
    public int GetParam(ArrayList<Param> alParam) {
        try {
            super.GetParam(alParam);
            alParam.add(new Param("Date", m_strDate, "时间对应字段", "Date", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("Precipitation", m_strRain, "降水对应字段", "Precipitation", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("Temperature", m_strTemp, "温度对应字段", "Temperature", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("SunshineHour", m_strSun, "日照时数对应字段", "SunshineHour", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strDadou", m_strDadou, "大豆单产", "m_strDadou", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strYumi", m_strYumi, "玉米单产", "m_strYumi", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strShuiDao", m_strShuiDao, "水稻单产", "m_strShuiDao", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strDadouRate", m_strDadouRate, "大豆丰歉率", "m_strDadouRate", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strYumiRate", m_strYumiRate, "玉米丰歉率", "m_strYumiRate", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strShuiDaoRate", m_strShuiDaoRate, "水稻丰歉率", "m_strShuiDaoRate", "参数匹配", Param.EditType.Default));
            alParam.add(new Param("m_strStartTime", m_strStartTime, "数据开始时间", "Time", "时间", Param.EditType.Default));
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        return alParam.size();
    }

    public boolean OnParamChanged(ArrayList<Param> alParam, int nIndex, Object objValue) {
        return super.OnParamChanged(alParam, nIndex, objValue);
    }

    //用于 XML->参数 等
    public int SetParam(final ArrayList<Param> alParam) {
        int i = super.SetParam(alParam);
        try {
            m_strDate = (String) alParam.get(i++).m_objValue;
            m_strRain = (String) alParam.get(i++).m_objValue;
            m_strTemp = (String) alParam.get(i++).m_objValue;
            m_strSun = (String) alParam.get(i++).m_objValue;
            m_strDadou = (String) alParam.get(i++).m_objValue;
            m_strYumi = (String) alParam.get(i++).m_objValue;
            m_strShuiDao = (String) alParam.get(i++).m_objValue;
            m_strDadouRate = (String) alParam.get(i++).m_objValue;
            m_strYumiRate = (String) alParam.get(i++).m_objValue;
            m_strShuiDaoRate = (String) alParam.get(i++).m_objValue;
            m_strStartTime = (String) alParam.get(i++).m_objValue;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return i;
    }

    public int GetOutputParam(Port port, ArrayList<Param> alParam) {
        int i = FindPort(port, false);
        if (i == -1) {
            return 0;
        }

        alParam.add(new Param("ResultString", m_listCSV));
        return alParam.size();
    }

    @SuppressWarnings("static-access")
    public boolean Execute() {

        m_inputRealityList.remove(1);
        m_inputRealityList.remove(0);
        m_inputStationDataList.addAll(m_inputRealityList);

        m_listCSV.clear();
        String head = "endDate,tempDadouWeaData,rainDadouWeaData,sunDadouWeaData,tempYumiWeaData,rainYumiWeaData,sunYumiWeaData,tempRiceWeaData,rainRiceWeaData,sunRiceWeaData";
        String type = "String,Double,Double,Double,Double,Double,Double,Double,Double,Double";
        m_listCSV.add(head);
        m_listCSV.add(type);
        List<WeaData> weaDataList = new ArrayList<WeaData>();
        Map<String, List<WeaData>> weaDataMap = new HashMap<String, List<WeaData>>();

        SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
        String str = m_strStartTime.replace("$ThisYear", sdfYear.format(m_model.m_dateDataStart));
        str = str.replace("$DateStart", sdfDate.format(m_model.m_dateDataStart));
        m_model.OutputLog(Model.LogLevel.Info, "STR" + str);
        Calendar dateNow = Calendar.getInstance();
        setDate(dateNow, sdfDate, str);

        if (m_inputStationDataList != null && m_inputStationDataList.size() > 0) {
            String foreHeader = m_inputStationDataList.get(0);
            if (!verifyHeader(foreHeader)) {
                m_model.OutputLog(Model.LogLevel.Error, "Header Can Not Match!");
                return false;
            } else {
                formatStationData(m_inputStationDataList, foreHeader, weaDataMap, weaDataList, dateNow, sdfDate);
            }

        }

        for (WeaData weaData : weaDataList) {
            List<WeaData> data = weaDataMap.get(weaData.getMMDD());
            double[] result = calcAvgValue(data);

            weaData.setAvgTemp(result[0]);
            weaData.setAvgRain(result[1]);
            weaData.setAvgSun(result[2]);
            weaData.setAvgDadou(result[3]);
            weaData.setAvgYumi(result[4]);
            weaData.setAvgShuidao(result[5]);

        }

        //显著性检验临界值
        double re = 0.296;

        for (WeaData weaData : weaDataList) {
            List<WeaData> data = weaDataMap.get(weaData.getYear());
            double[] result = calcRValue(data, weaData);

            weaData.setrDadouTemp(result[0] >= re ? result[0] : 0);
            weaData.setrDadouRain(result[1] >= re ? result[1] : 0);
            weaData.setrDadouSun(result[2] >= re ? result[2] : 0);

            weaData.setrYumiTemp(result[3] >= re ? result[3] : 0);
            weaData.setrYumiRain(result[4] >= re ? result[4] : 0);
            weaData.setrYumiSun(result[5] >= re ? result[5] : 0);

            weaData.setrShuiDaoTemp(result[6] >= re ? result[6] : 0);
            weaData.setrShuiDaoRain(result[7] >= re ? result[7] : 0);
            weaData.setrShuiDaoSun(result[8] >= re ? result[8] : 0);
        }

        double tempDadouWeaData = 0;
        double rainDadouWeaData = 0;
        double sunDadouWeaData = 0;

        double tempYumiWeaData = 0;
        double rainYumiWeaData = 0;
        double sunYumiWeaData = 0;

        double tempRiceWeaData = 0;
        double rainRiceWeaData = 0;
        double sunRiceWeaData = 0;
        for (int i = 3; i < weaDataList.size(); i++) {
            WeaData weaData = weaDataList.get(i);
            tempDadouWeaData += weaData.getrDadouTemp() * weaData.getAvgTemp();
            rainDadouWeaData += weaData.getrDadouRain() * weaData.getAvgRain();
            sunDadouWeaData += weaData.getrDadouSun() * weaData.getAvgSun();

            tempYumiWeaData += weaData.getrYumiTemp() * weaData.getAvgTemp();
            rainYumiWeaData += weaData.getrYumiRain() * weaData.getAvgRain();
            sunYumiWeaData += weaData.getrYumiSun() * weaData.getAvgSun();

            tempRiceWeaData += weaData.getrShuiDaoTemp() * weaData.getAvgTemp();
            rainRiceWeaData += weaData.getrShuiDaoRain() * weaData.getAvgRain();
            sunRiceWeaData += weaData.getrShuiDaoSun() * weaData.getAvgSun();
        }
//        double[] forecastRate = calcForecastRate(tempWeaData, rainWeaData, sunWeaData);
        String data = str + "," + tempDadouWeaData + "," + rainDadouWeaData + "," + sunDadouWeaData
                + "," + tempYumiWeaData + "," + rainYumiWeaData + "," + sunYumiWeaData
                + "," + tempRiceWeaData + "," + rainRiceWeaData + "," + sunRiceWeaData;
        m_listCSV.add(data);
        OnParamChanged();
        return true;
    }

    private double[] calcYield(WeaData[] yearWeaData) {
        double dadouRate = 0;
        double yumiRate = 0;
        double shuidaoRate = 0;
        for (WeaData weaData : yearWeaData) {
            dadouRate += weaData.getDadou();
            yumiRate += weaData.getYumi();
            shuidaoRate += weaData.getShuidao();
        }
        double[] rate = {dadouRate / 5, yumiRate / 5, shuidaoRate / 5};
        return rate;
    }

    private WeaData[] addToYearWeaData(WeaData weaData, WeaData[] yearWeaData) {
        WeaData[] temp = new WeaData[5];
        temp[0] = yearWeaData[0];
        temp[1] = yearWeaData[1];
        temp[2] = yearWeaData[2];
        temp[3] = yearWeaData[3];
        temp[4] = weaData;
        for (int i = 1; i < temp.length; i++) {
            WeaData tmp = temp[i];
            int j = i - 1;
            while (j >= 0 && Integer.parseInt(tmp.getYear()) > Integer.parseInt(temp[j].getYear())) {
                temp[j + 1] = temp[j];
                j--;
            }
            temp[j + 1] = tmp;
        }
        yearWeaData[0] = temp[0];
        yearWeaData[1] = temp[1];
        yearWeaData[2] = temp[2];
        yearWeaData[3] = temp[3];
        return yearWeaData;
    }

    private double[] calcForecastRate(WeaData[] tempWeaData, WeaData[] rainWeaData, WeaData[] sunWeaData) {
        double dadouRate = 0;
        double yumiRate = 0;
        double shuidaoRate = 0;
        for (WeaData weaData : tempWeaData) {
            dadouRate += weaData.getDadouRate();
            yumiRate += weaData.getYumiRate();
            shuidaoRate += weaData.getShuidaoRate();
            m_model.OutputLog(Model.LogLevel.Info, "tempWeaData:" + weaData.getDate() + "DaDouRate:" + weaData.getDadouRate() + "YuMiRate" + weaData.getYumiRate() + "ShuiDaoRate" + weaData.getShuidaoRate());
        }
        for (WeaData weaData : rainWeaData) {
            dadouRate += weaData.getDadouRate();
            yumiRate += weaData.getYumiRate();
            shuidaoRate += weaData.getShuidaoRate();
            m_model.OutputLog(Model.LogLevel.Info, "rainWeaData:" + weaData.getDate() + "DaDouRate:" + weaData.getDadouRate() + "YuMiRate" + weaData.getYumiRate() + "ShuiDaoRate" + weaData.getShuidaoRate());
        }
        for (WeaData weaData : sunWeaData) {
            dadouRate += weaData.getDadouRate();
            yumiRate += weaData.getYumiRate();
            shuidaoRate += weaData.getShuidaoRate();
            m_model.OutputLog(Model.LogLevel.Info, "sunWeaData:" + weaData.getDate() + "DaDouRate:" + weaData.getDadouRate() + "YuMiRate" + weaData.getYumiRate() + "ShuiDaoRate" + weaData.getShuidaoRate());
        }
        double[] rate = {dadouRate / 9, yumiRate / 9, shuidaoRate / 9};
        return rate;
    }

    private WeaData[] addToSunWeaData(WeaData weaData, WeaData[] sunWeaData) {
        WeaData[] temp = new WeaData[4];
        temp[0] = sunWeaData[0];
        temp[1] = sunWeaData[1];
        temp[2] = sunWeaData[2];
        temp[3] = weaData;
        for (int i = 1; i < temp.length; i++) {
            WeaData tmp = temp[i];
            int j = i - 1;
            while (j >= 0 && tmp.getCKSun() > temp[j].getCKSun()) {
                temp[j + 1] = temp[j];
                j--;
            }
            temp[j + 1] = tmp;
        }
        sunWeaData[0] = temp[0];
        sunWeaData[1] = temp[1];
        sunWeaData[2] = temp[2];
        return sunWeaData;
    }

    private WeaData[] addToRainWeaData(WeaData weaData, WeaData[] rainWeaData) {
        WeaData[] temp = new WeaData[4];
        temp[0] = rainWeaData[0];
        temp[1] = rainWeaData[1];
        temp[2] = rainWeaData[2];
        temp[3] = weaData;
        for (int i = 1; i < temp.length; i++) {
            WeaData tmp = temp[i];
            int j = i - 1;
            while (j >= 0 && tmp.getCKRain() > temp[j].getCKRain()) {
                temp[j + 1] = temp[j];
                j--;
            }
            temp[j + 1] = tmp;
        }
        rainWeaData[0] = temp[0];
        rainWeaData[1] = temp[1];
        rainWeaData[2] = temp[2];
        return rainWeaData;
    }

    private WeaData[] addToTempWeaData(WeaData weaData, WeaData[] tempWeaData) {
        WeaData[] temp = new WeaData[4];
        temp[0] = tempWeaData[0];
        temp[1] = tempWeaData[1];
        temp[2] = tempWeaData[2];
        temp[3] = weaData;
        for (int i = 1; i < temp.length; i++) {
            WeaData tmp = temp[i];
            int j = i - 1;
            while (j >= 0 && tmp.getCKTemp() > temp[j].getCKTemp()) {
                temp[j + 1] = temp[j];
                j--;
            }
            temp[j + 1] = tmp;
        }
        tempWeaData[0] = temp[0];
        tempWeaData[1] = temp[1];
        tempWeaData[2] = temp[2];
        return tempWeaData;
    }

    private double[] calcRValue(List<WeaData> data, WeaData calWeaData) {
        double rain = 0;
        double temp = 0;
        double sun = 0;
        double rain1 = 0;
        double temp1 = 0;
        double sun1 = 0;
        double rain2 = 0;
        double temp2 = 0;
        double sun2 = 0;

        double avgRain = 0;
        double avgTemp = 0;
        double avgSun = 0;

        double avgDadou = 0;
        double avgYumi = 0;
        double avgShuiDao = 0;

        for (WeaData weaData : data) {
            rain += (weaData.getDeltaRain() - calWeaData.getAvgRain()) * (weaData.getDadou() - calWeaData.getAvgDadou());
            temp += (weaData.getDeltaTemp() - calWeaData.getAvgTemp()) * (weaData.getDadou() - calWeaData.getAvgDadou());
            sun += (weaData.getDeltaSun() - calWeaData.getAvgSun()) * (weaData.getDadou() - calWeaData.getAvgDadou());

            rain1 += (weaData.getDeltaRain() - calWeaData.getAvgRain()) * (weaData.getYumi() - calWeaData.getAvgYumi());
            temp1 += (weaData.getDeltaTemp() - calWeaData.getAvgTemp()) * (weaData.getYumi() - calWeaData.getAvgYumi());
            sun1 += (weaData.getDeltaSun() - calWeaData.getAvgSun()) * (weaData.getYumi() - calWeaData.getAvgYumi());

            rain2 += (weaData.getDeltaRain() - calWeaData.getAvgRain()) * (weaData.getShuidao() - calWeaData.getShuidao());
            temp2 += (weaData.getDeltaTemp() - calWeaData.getAvgTemp()) * (weaData.getShuidao() - calWeaData.getAvgShuidao());
            sun2 += (weaData.getDeltaSun() - calWeaData.getAvgSun()) * (weaData.getShuidao() - calWeaData.getAvgShuidao());

            avgRain += Math.pow(weaData.getDeltaRain() - calWeaData.getAvgRain(), 2);
            avgTemp += Math.pow(weaData.getDeltaTemp() - calWeaData.getAvgTemp(), 2);
            avgSun += Math.pow(weaData.getDeltaSun() - calWeaData.getAvgSun(), 2);

            avgDadou += Math.pow(weaData.getDadou() - calWeaData.getAvgDadou(), 2);
            avgYumi += Math.pow(weaData.getYumi() - calWeaData.getAvgYumi(), 2);
            avgShuiDao += Math.pow(weaData.getShuidao() - calWeaData.getAvgShuidao(), 2);
        }
        double[] result = new double[9];
        result[0] = temp / Math.sqrt(avgTemp * avgDadou);
        result[1] = rain / Math.sqrt(avgRain * avgDadou);
        result[2] = sun / Math.sqrt(avgSun * avgDadou);

        result[3] = temp1 / Math.sqrt(avgTemp * avgYumi);
        result[4] = rain1 / Math.sqrt(avgRain * avgYumi);
        result[5] = sun1 / Math.sqrt(avgSun * avgYumi);

        result[6] = temp2 / Math.sqrt(avgTemp * avgShuiDao);
        result[7] = rain2 / Math.sqrt(avgRain * avgShuiDao);
        result[8] = sun2 / Math.sqrt(avgSun * avgShuiDao);
        return result;
    }

    private double[] calcAvgValue(List<WeaData> data) {
        double avgRain = 0;
        double avgTemp = 0;
        double avgSun = 0;
        double avgDadou = 0;
        double avgYumi = 0;
        double avgShuidao = 0;

        for (WeaData weaData : data) {
            avgRain += weaData.getDeltaRain();
            avgTemp += weaData.getDeltaTemp();
            avgSun += weaData.getDeltaSun();
            avgDadou += weaData.getDadou();
            avgYumi += weaData.getYumi();
            avgShuidao += weaData.getShuidao();
        }
        double[] result = new double[6];
        result[0] = avgTemp / data.size();
        result[1] = avgRain / data.size();
        result[2] = avgSun / data.size();
        result[3] = avgDadou / data.size();
        result[4] = avgYumi / data.size();
        result[5] = avgShuidao / data.size();
        return result;
    }

    private WeaData findWeaData(List<WeaData> calcWeaData, String mmdd) {
        for (WeaData weaData : calcWeaData) {
            if (weaData.getMMDD().equals(mmdd)) {
                return weaData;
            }
        }
        return null;
    }

    private void setDate(Calendar dateNow, SimpleDateFormat sdfDate, String str) {
        try {
            dateNow.setTime(sdfDate.parse(str));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    private WeaData formatStationData(List<String> inputRealityList, String realHeader, Map<String, List<WeaData>> weaDataMap, List<WeaData> weaDataList, Calendar dateNow, SimpleDateFormat sdfDate) {
        Calendar calendar = Calendar.getInstance();
        int realDateIndex = findDataIndex(realHeader, m_strDate);
        int realRainIndex = findDataIndex(realHeader, m_strRain);
        int realTempIndex = findDataIndex(realHeader, m_strTemp);
        int realSunIndex = findDataIndex(realHeader, m_strSun);

        int realDadouIndex = findDataIndex(realHeader, m_strDadou);
        int realYumiIndex = findDataIndex(realHeader, m_strYumi);
        int realShuiDaoIndex = findDataIndex(realHeader, m_strShuiDao);

        String date = "";
        int dayNow = dateNow.get(Calendar.DAY_OF_MONTH);
        int monthNow = dateNow.get(Calendar.MONTH);
        int yearNow = dateNow.get(Calendar.YEAR);
        for (int i = 2; i < inputRealityList.size(); i++) {
            String[] data = inputRealityList.get(i).split(",");

            date = data[realDateIndex];
            setDate(calendar, sdfDate, date);
            int day = calendar.get(Calendar.DAY_OF_MONTH);
            int month = calendar.get(Calendar.MONTH);
            int year = calendar.get(Calendar.YEAR);

            WeaData weaData = new WeaData();
            weaData.setDate(date);
            weaData.setYear(String.valueOf(year));
            weaData.setMMDD(month + "-" + day);
            weaData.setDeltaRain(Float.parseFloat(data[realRainIndex]));
            weaData.setDeltaTemp(Float.parseFloat(data[realTempIndex]));
            weaData.setDeltaSun(Float.parseFloat(data[realSunIndex]));

            if (!data[realDadouIndex].equals("null")) {
                weaData.setDadou(Float.parseFloat(data[realDadouIndex]));
                weaData.setYumi(Float.parseFloat(data[realYumiIndex]));
                weaData.setShuidao(Float.parseFloat(data[realShuiDaoIndex]));
            }


            if (month < monthNow || (month == monthNow && day <= dayNow)) {

                if (yearNow == year) {
                    weaDataList.add(weaData);
                } else {
                    addToMap(weaDataMap, month + "-" + day, weaData);
                }
            }

//            if (month < monthNow) {
//                addToMap(weaDataMap, month + "-" + day, weaData);
//            } else if (month == monthNow) {
//                if (day <= dayNow) {
//
//                } else {
//                    m_model.OutputLog(Model.LogLevel.Info, "WEA_DATA DO NOT FIT:DAY=" + day + "MONTH=" + month);
//                }
//            } else {
//                m_model.OutputLog(Model.LogLevel.Info, "WEA DATA DO NOT FIT:DAY" + day + "MONTH=" + month);
//            }

        }
        return null;
    }

    //获取最近四年数据
    private void addToOldMap(int year, int yearNow, String key, WeaData weaData) {
        int tmpYear = yearNow - year;
//        for (String :
//             ) {
//
//        }
//        if(year)
    }

    private void addToMap(Map<String, List<WeaData>> weaDataMap, String date, WeaData weaData) {
        if (weaDataMap.keySet().contains(date)) {
            weaDataMap.get(date).add(weaData);
        } else {
            List<WeaData> data = new ArrayList<WeaData>();
            data.add(weaData);
            weaDataMap.put(date, data);
        }
    }

    /**
     * 表头检验
     *
     * @param realHeader 实况数据表头
     * @return
     */
    private boolean verifyHeader(String realHeader) {

        if (realHeader.contains(m_strDate) && realHeader.contains(m_strTemp)) {
            if (realHeader.contains(m_strRain) && realHeader.contains(m_strSun)) {
                return true;
            }
        }
        return false;
    }

    private int findDataIndex(String realHeader, String strRain) {

        String[] data = realHeader.split(",");
        for (int i = 0; i < data.length; i++) {
            if (data[i].equalsIgnoreCase(strRain)) {
                return i;
            }
        }
        return -1;
    }

    private List<String> m_inputStationDataList = new ArrayList<String>();
    private List<String> m_inputRealityList = new ArrayList<String>();
    private List<String> m_listCSV = new ArrayList<String>();

    private Map<String, WeaData> m_oldWeaDataMap1 = new HashMap<String, WeaData>();
    private Map<String, WeaData> m_oldWeaDataMap2 = new HashMap<String, WeaData>();
    private Map<String, WeaData> m_oldWeaDataMap3 = new HashMap<String, WeaData>();
    private Map<String, WeaData> m_oldWeaDataMap4 = new HashMap<String, WeaData>();

    private String m_strDate;
    private String m_strRain;
    private String m_strTemp;
    private String m_strSun;
    private String m_strDadou;
    private String m_strYumi;
    private String m_strShuiDao;
    private String m_strDadouRate;
    private String m_strYumiRate;
    private String m_strShuiDaoRate;
    private String m_strStartTime;
}
